<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>客户信息</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../../js/element-ui-2.13.0/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="../../styles/common.css"/>
    <link rel="stylesheet" href="../../styles/index.css"/>
    <link rel="stylesheet" href="../../styles/icon/iconfont.css"/>
    <link rel="stylesheet" href="../../styles/pages.css"/>
</head>
<body>
<div class="dashboard-container" id="category-app">
    <div class="container">
        <div>
            请设置处理后的号码长度：<el-input
                    placeholder="设置号码长度"
                    style="display: inline-block;width: 200px;"
                    v-model="length"
            >
            </el-input>
        </div>
        <div
                class="tableBar"
                style="display: inline-block"
        >
            <div>
                <div>
                    <el-upload
                            :action="'/api/customer/addWhite?length='+length"
                            :before-remove="beforeRemove"
                            :on-success="data"
                            list-type="text"
                            :multiple="false"
                            drag
                            :file-list="fileList"
                            :on-remove="handleRemove"
                    >
                        <el-button size="medium" type="primary">上传文件加白</el-button>
                    </el-upload>
                </div>
                <div>
                    <el-button type="primary"  @click="addWhiteNumber">加白号码字符串</el-button>
                    <el-button type="primary"  @click="updateWhiteNumber">已加白号码去重</el-button>
                </div>
                <div>
                    <el-input
                            type="textarea"
                            placeholder="需要加白号码"
                            :rows="8"
                            clearable
                            v-model="unWhiteNumber"
                    >
                    </el-input>
                    <el-input
                            type="textarea"
                            placeholder="已加白号码"
                            :rows="8"
                            clearable
                            v-model="whiteNumber"
                    >
                    </el-input>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../js/vue.js"></script>
<script src="../../js/element-ui-2.13.0/lib/index.js"></script>
<script src="../../js/axios-0.18.0.js"></script>
<script src="../../js/request.js"></script>
<script src="../../js/query.js"></script>
<script>
    new Vue({
        el: '#category-app',
        data() {
            return {
                ANumber: '',
                unWhiteNumber: '',
                whiteNumber: '',
                uploadAction: '',
                length: 4,
                fileList: []
            }
        },
        methods: {
            addWhiteNumber(){
                this.init2();
            },
            updateWhiteNumber(){
                this.init3();
            },
            async init2(){
                await addWhite({
                    'length': this.length,
                    'unWhiteNumber': this.unWhiteNumber
                }).then(res => {
                    this.whiteNumber = res;
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                });
            },
            async init3(){
                await updateWhite({
                    'length': this.length,
                    'unWhiteNumber': this.unWhiteNumber
                }).then(res => {
                    this.whiteNumber = res;
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                });
            },
            data(res){
                this.whiteNumber = res;
            }
        }
    })
</script>
</body>
</html>